package com.hong.aspect;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;

/**
 * <br>TODO(描述该类的作用)</br>
 *
 * @author 533735
 * @version 1.0
 * @email wanghong3@dafycredit.com
 * @date 2018/11/6 15:28
 * @since 1.0
 */
@Aspect
@Order(2)
public class AnotherAspect implements Ordered{
    /**
     * 经测试发现,如果MultiAdviceAspect和AnotherAspect都使用了@Order注解,
     * 且都没有实现Ordered接口,则Advice执行顺序按照@Order声明的优先级;
     * 但如果AnotherAspect实现了Ordered接口,而MultiAdviceAspect没有实现,则不管@Order咋样,
     * AnotherAspect里的before总是先于ultiAdviceAspect中的before执行
     */
    @Pointcut("execution(* com.hong.service..*.*(..))")
    public void taskExecution(){ }

    @Before("taskExecution()")
    public void before(){
        System.out.println("before three");
    }

    @Override
    public int getOrder() {
        return -1000000;
    }
}
